package com.tuku.aixiaozhi.tools;

import dev.langchain4j.agent.tool.P;
import dev.langchain4j.agent.tool.Tool;
import dev.langchain4j.agent.tool.ToolMemoryId;
import org.springframework.stereotype.Component;

@Component
public class CalculatorTools {

    @Tool(name = "加法运算",value = "将两个参数a和b相加返回运算结果")
    double sum(@P(value = "加数1",required = true) double a,
               @ToolMemoryId int memoryId,
               double b) {
        System.out.println("调用加法运算");
        return a + b;
    }

    @Tool(name = "平方根运算",value = "将参数x的平方根返回")
    double squareRoot(double x) {
        System.out.println("调用平方根运算");
        return Math.sqrt(x);
    }
}